package com.module.msg.utils

import android.content.Context
import android.content.Intent
import android.widget.Toast
import com.module.app.base.BaseApplication
import com.module.app.ext.notNull
import com.module.msg.bean.MsgBean
import com.module.msg.view.AddMsgActivity
import com.module.msg.view.HotMsgActivity

const val EXTRA_BEAN = "bean"

fun Context?.startMsg(bean: MsgBean?) {
    notNull({
        var intent = Intent(this, AddMsgActivity::class.java)
        intent.putExtra(EXTRA_BEAN, bean)
        it.startActivity(intent)
    }, {
        Toast.makeText(com.module.app.base.BaseApplication.getContext(), "启动异常", Toast.LENGTH_LONG).show()
    })
}

fun Context?.startHot() {
    notNull({
        var intent = Intent(this, HotMsgActivity::class.java)
        it.startActivity(intent)
    }, {
        Toast.makeText(com.module.app.base.BaseApplication.getContext(), "启动异常", Toast.LENGTH_LONG).show()
    })
}
